﻿using System.Text;

namespace _42_C_读取txt文件内容
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string path_ = AppDomain.CurrentDomain.BaseDirectory;
            string basePath = Directory.GetCurrentDirectory();
            string path = basePath + System.IO.Path.DirectorySeparatorChar + "1.txt";

            //string content=File.ReadAllText(path);//读取所有的内容
            //string content1=File.ReadAllText(path,Encoding.UTF8);

            //Console.WriteLine(content);
            //Console.WriteLine(content1);

            //string[] content = File.ReadAllLines(path);
            //string[] content1 = File.ReadAllLines(path, Encoding.UTF8);

            //foreach (var item in content)
            //{
            //    Console.WriteLine(item);
            //}
            //foreach (var item in content1)
            //{
            //    Console.WriteLine(item);
            //}

            StreamReader strReader = new StreamReader(path);
            StreamReader strReader1 = File.OpenText(path);

            //string str1 = strReader.ReadLine();
            //string str2 = strReader1.ReadLine();
            //Console.WriteLine(str1);
            //Console.WriteLine(str2);

            //while (strReader.ReadLine() != null)
            //{

            //}

            //while (!strReader.EndOfStream)
            //{

            //}

            //int strchar = strReader.Read();
            //char ch = (char)strchar;

            //Console.WriteLine(ch);

            int n = 10;

            char[] buffer=new char[n];

            int i=strReader.Read(buffer, 0, n);

            foreach (var item in buffer)
            {
                
            }
        }
    }
}
